<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="./Public/Home/org/shop.css"/>
		<script src="./Public/jquery-1.8.2.min.js"></script>
		<script>
			$(function(){	
				$("#toggle-checkboxes_down").click(function(){
//					购物车goods的建
//					var total=<?php echo $_SESSION['cart']['total']?>
//					var seid=$(this).attr('key');
//					var num=$(this).parent().parent().siblings().next().children().attr('value');				
					if($('input:checkbox:checked').val()){		

                    $.ajax({
						type:"post",
						url:"<?php echo U('Cart/select_code')?>",
						data:{session:''},
						dataType:'json',
						success:function(db){
							console.log(db);
							$('.money').text(db.totals);	
							
							$('#shopnum').text(db.shopnums);					
						}
					});
                }else{
                	$('.money').text('0');
                	$('#shopnum').text('0');
                }
                
				})			
				$(".sel").change(function(){
					var cid=$(this).children().first().attr('cid');
					var num=$(this).val();
//					alert(num);
					var sid=$(this).attr('key');				
					$.ajax({
					type:'post',
					url:"<?php echo U('Cart/edit')?>",
					data:{num:num,sid:sid},
					dataType:'json',
					success:function(db){
						$('.aa'+cid).text(db.total);
						$('.money').text(db.totals);
					}				
					})						
				});				
			})
		</script>	
	
	</head>	
	<body>
		<!--头部-->
		<div id="top">			
			<ul class="top_long">
				<a href=""><div class="qczj"><img src="./Public/Home/imgs/logo-auto-92438.png"/></div></a>			
				<a href="http://localhost/car_shop/index.php?m=Home&c=Dingdan&a=index"><li myOrder>我的订单</li></a>	
				<span class="shu">|</span>
								<a href="http://localhost/car_shop/index.php?m=Home&c=Member&a=out"><li class="login">退出 </li></a>
					
				<a href="http://localhost/car_shop/index.php?m=Home&c=Member&a=index"><li class="login">admin </li></a>


							</ul>			
		</div>
		<!--大盒子-->
		<div id="box">
			<!--搜索开始-->
			<div id="search">
					<a href=""> <img class="tupian" src="./Public/Home/imgs/header-logo-mall-363de.png"/></a>
					<div id="search_in">
<!--						<input type="text" name="" id="" value="" placeholder="请输入关键字" /><a href="" class="sousuo">搜索</a>-->
						<form action='<?php echo U("home/List/ss")?>' method='post'>
							<input type="text" name="ss" id="" value="" placeholder="请输入关键字" />
							<input type='submit' class="sousuo" value='搜索'>
						</form>
					</div>										
			</div>
			<!--搜索结束-->
			<!--分类导航-->
			<div id="category">
				<ul>
					<a href=""><li class="first">我的购物车</li></a>
					<a href="<?php echo U('Index/index')?>"><li class="second">首页</li></a>
					<?php foreach ($cateData as $v){?>
					<a href="<?php echo U('List/index',array('cid'=>$v['cid']))?>"><li class="three"><?php echo $v['cname']?></li></a>
					<?php }?>
					<!--<a href=""><li class="three">级别</li></a>-->
					<!--<a href=""><li class="four">分期购车</li></a>
					<a href=""><li class="three">定制车</li></a>-->
				</ul>			
			</div>
			<div class="gwc">
				<ul>
					<li class="allsp">全部商品(<?php echo count($data)?>)</li>
					<li>订单价格</li>
					<li>数量</li>
					<li>小计</li>
					<li>操作</li>
				</ul>				
			</div>	
			<?php if($data!=null):?>
			<div class="jianjie">
				<?php foreach ($data as $k=>$v){?>
					<ul>
						<a href="<?php echo U('Content/index',array('sid'=>$v['id']))?>">
							<li  class="jianjie-li">						
								<img width="168" height="126" src="<?php echo $v['options']['listgroup']?>"/>
								<span class="wenzi"><?php echo $v['name']?></span>
								<?php foreach ($v['options']['attribute'] as $value){?>
								<span class="wenzi"><?php echo $value?></span>
								<?php }?>
								<!--<input key="<?php echo $k?>" num="<?php echo $v['num']?>"  class="selects" style="float: left;margin-top: 5px;"  type="checkbox"  id="" name="toggle-checkboxes" ><label for="toggle-checkboxes_down"></label>-->													
							</li>
						</a>
						<li><?php echo $v['price']?>万</li>
						<li><select name="" key="<?php echo $k?>" class="sel">stock
								<?php for($i=1;$i<$v['options']['stock']+1;$i++){?>
								<option cid="<?php echo $v['id']?>" value="<?php echo $i?>" <?php if($v['num']==$i):?>selected="selected"<?php endif?>><?php echo $i?></option>
								<?php } ?>
						</select></li>
						<li ><span class="aa<?php echo $v['id']?>"><?php echo $v['total']?></span>万</li>
						<li class="delete">
							<a href="<?php echo U('del',array('del'=>$k))?>">删除</a>&nbsp;
							<a href="<?php echo U('Content/index',array('sid'=>$v['id']))?>">商品详情</a>							
						</li>
					</ul>
					<?php }?>
			</div>
				<?php else:?>
				<div style="width: 1170px; height: 50px; line-height: 50px;font-size: 20px; background: #CCCCCC; text-align: center; color: crimson;">
					你的爱车在等着你，去商城看看吧！
				</div>
			<?php endif ?>
			<div class="jiesuan">
				<ul>
					<li><input type="checkbox" checked="checked" id="toggle-checkboxes_down" name="toggle-checkboxes" ><label for="toggle-checkboxes_down">全选</label></li>
					<a href="<?php echo U('Cart/dels')?>"><li>清空购物车</li></a>
					<!--<a href=""><li>移到我的关注</li></a>
					<a href=""><li>清除下柜商品</li></a>-->
					<li class="lingjian">已选择<span id="shopnum"><?php echo $shopnums?></span>件商品&nbsp;总价：￥<span class="money"><?php echo $_SESSION['cart']['total']?></span>万</li>
					<a href="<?php echo U('Tijiao/index')?>"><li class="beijing">去结算</li></a>
				</ul>				
			</div>		
		</div>			
		<!--公共底部-->
		<!--底部-->
		<div id="footer">
			<div id="footer1">
				<div class="footer_logo">
					<img src="./Public/Home/imgs/logo-footer.png"/>
				</div>							
			</div>			
		</div>
		<div id="banquan">
			<span>© 2004-2016 www.autohome.com.cn All Rights Reserved. 汽车之家 版权所有</span>
		</div>
	</body>
</html>
